/**
 * Copyright 2007-2010 非也
 * All rights reserved. 
 * 
 * This library is free software; you can redistribute it and/or modify it under the
 * terms of the GNU Lesser General Public License v3 as published by the Free Software
 * Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License along
 * with this library; if not, see http://www.gnu.org/licenses/lgpl.html.
 *
 */
package org.fireflow2.designer.eclipse.figures.widget;

import org.eclipse.draw2d.AbstractBorder;
import org.eclipse.draw2d.ColorConstants;
import org.eclipse.draw2d.Graphics;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.geometry.Insets;
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.swt.SWT;
import org.fireflow2.designer.eclipse.util.Util4Eclipse;

/**
 *
 * @author 非也 nychen2000@163.com
 * Fire Workflow 官方网站：www.firesoa.com 或者 www.fireflow.org
 *
 */
public class SelectionHandleBorder extends AbstractBorder {

	/* (non-Javadoc)
	 * @see org.eclipse.draw2d.Border#getInsets(org.eclipse.draw2d.IFigure)
	 */
	public Insets getInsets(IFigure figure) {
		// TODO Auto-generated method stub
		return null;
	}

	/* (non-Javadoc)
	 * @see org.eclipse.draw2d.Border#paint(org.eclipse.draw2d.IFigure, org.eclipse.draw2d.Graphics, org.eclipse.draw2d.geometry.Insets)
	 */
	public void paint(IFigure figure, Graphics graphics, Insets insets) {
		Rectangle bounds = figure.getBounds();
		Rectangle rectangle = new Rectangle(bounds);
		graphics.pushState();
		graphics.setForegroundColor(Util4Eclipse.colorStr2ColorObj("#B0C4DE"));
		graphics.setBackgroundColor(ColorConstants.white);
		graphics.setLineStyle(SWT.LINE_DOT);
		graphics.setLineDash(new int[]{1});
		rectangle.resize(-1,-1);
		graphics.drawRectangle(rectangle);
		
		rectangle.translate(2, 2);
		rectangle.resize(-4, -4);		
		graphics.drawRectangle(rectangle);
		
		rectangle.translate(2, 2);
		rectangle.resize(-4, -4);
		graphics.drawRectangle(rectangle);
		
		graphics.popState();

	}

}
